package cn.edu.sdjzu.xg23.kcsj01_backend.mapper;

import cn.edu.sdjzu.xg23.kcsj01_backend.entity.Employee;
import cn.edu.sdjzu.xg23.kcsj01_backend.entity.EmployeeAssInstruction;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;


@Mapper
public interface EmployeeAssInstructionMapper {
    // 根据批示id查询所有申报人（保持与专利模块一致命名）
    List<EmployeeAssInstruction> getApplicantsByInstructionId(Long instructionId);

    // 根据批示id查询第一申报人（保持与专利模块一致命名）
    Employee getFirstApplicantByInstructionId(Long instructionId);

    // 批量插入申报人
    boolean insertApplicants(@Param("list") List<EmployeeAssInstruction> list);

    // 根据批示ID删除所有申报人（修正表名和字段名）
    @Delete("DELETE FROM employee_instruction WHERE instruction_id = #{instructionId}")
    int deleteByInstructionId(Long instructionId);
}